home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kdesu / stub.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  3.3 KB  |  140 lines

  1. /* vi: ts=8 sts=4 sw=4
  2.  *
  3.  * $Id: stub.h 363273 2004-11-15 22:43:23Z mueller $
  4.  *
  5.  * This file is part of the KDE project, module kdesu.
  6.  * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
  7.  * 
  8.  * This is free software; you can use this library under the GNU Library 
  9.  * General Public License, version 2. See the file "COPYING.LIB" for the 
  10.  * exact licensing terms.
  11.  */
  12.  
  13. #ifndef __Stub_h_Included__
  14. #define __Stub_h_Included__
  15.  
  16. #include <qcstring.h>
  17. #include <qvaluelist.h>
  18.  
  19. #include "process.h"
  20. #include "kcookie.h"
  21.  
  22. #include <kdelibs_export.h>
  23.  
  24. typedef QValueList<QCString> QCStringList;
  25.  
  26. /**
  27.  * Chat with kdesu_stub.
  28.  *
  29.  * StubProcess extends PtyProcess with functionality to chat with kdesu_stub.
  30.  */
  31.  
  32. class KDESU_EXPORT StubProcess: public PtyProcess
  33. {
  34. public:
  35.     StubProcess();
  36.     ~StubProcess();
  37.  
  38.     /**
  39.      * Specify dcop transport
  40.      */
  41.     void setDcopTransport(const QCString &dcopTransport) 
  42.        { m_pCookie->setDcopTransport(dcopTransport); }
  43.  
  44.     /**
  45.      * Set the command.
  46.      */
  47.     void setCommand(const QCString &command) { m_Command = command; }
  48.  
  49.     /**
  50.      * Set the target user.
  51.      */
  52.     void setUser(const QCString &user) { m_User = user; }
  53.  
  54.     /**
  55.      * Set to "X only mode": Sycoca is not built and kdeinit is not launched.
  56.      */
  57.     void setXOnly(bool xonly) { m_bXOnly = xonly; }
  58.  
  59.     /**
  60.      * Enable DCOP forwarding.
  61.      */
  62.     void setDCOPForwarding(bool dcopForwarding) { m_bDCOPForwarding = dcopForwarding; }
  63.  
  64.     /**
  65.      * Set the priority of the process. The priority value must be between 0
  66.      * and 100, 0 being the lowest priority. This value is mapped to the
  67.      * scheduler and system dependant priority range of the OS.
  68.      */
  69.     void setPriority(int prio);
  70.  
  71.     /**
  72.      * Different schedulers. SchedNormal is the normal Unix timesharing
  73.      * scheduler, while SchedRealtime is a POSIX.1b realtime scheduler.
  74.      */
  75.     enum Scheduler { SchedNormal, SchedRealtime };
  76.  
  77.     /**
  78.      * Set the scheduler type. 
  79.      */
  80.     void setScheduler(int sched) { m_Scheduler = sched; }
  81.  
  82. protected:
  83.  
  84.     /**
  85.      * Exchange all parameters with kdesu_stub.
  86.      */
  87.     int ConverseStub(int check);
  88.  
  89.     /**
  90.      * Notify the taskbar that a new application has been started.
  91.      * @obsolete
  92.      */
  93.     // KDE4 remove
  94.     void notifyTaskbar(const QString &suffix);
  95.  
  96.     /** 
  97.      * This virtual function can be overloaded when special behavior is
  98.      * desired. By default, it returns the value returned by KCookie.
  99.      */
  100.     virtual QCString display() { return m_pCookie->display(); }
  101. #ifdef Q_WS_X11
  102.     /**
  103.      * See display.
  104.      */
  105.     virtual QCString displayAuth() { return m_pCookie->displayAuth(); }
  106. #endif
  107.     /**
  108.      * See display.
  109.      */
  110.     virtual QCString dcopServer() { return m_pCookie->dcopServer(); }
  111.     /**
  112.      * See display.
  113.      */
  114.     virtual QCString dcopAuth() { return m_pCookie->dcopAuth(); }
  115.     /**
  116.      * See display.
  117.      */
  118.     virtual QCString iceAuth() { return m_pCookie->iceAuth(); }
  119.  
  120.     bool m_bXOnly;
  121.     bool m_bDCOPForwarding;
  122.     int m_Priority;
  123.     int  m_Scheduler;
  124.     QCString m_dcopTransport;
  125.     QCString m_Command;
  126.     QCString m_User;
  127.     KCookie *m_pCookie;
  128.     
  129. private:
  130.     QCString commaSeparatedList(QCStringList);
  131.  
  132. protected:
  133.     virtual void virtual_hook( int id, void* data );
  134. private:
  135.     class StubProcessPrivate;
  136.     StubProcessPrivate *d;
  137. };
  138.  
  139. #endif // __Stub_h_Included__
  140.